package com.wdc.recursion;

@SuppressWarnings({"all"})
public class E06Sum {
    //递归求和
    public static long sum(long n,long accumulator){

        if (n == 1 ){
            return 1 + accumulator;
        }

        return sum(n -1 ,n + accumulator) ;

    }

    public static void main(String[] args) {
        System.out.println(sum(5,0));
    }


}
